grammar = laban
CPP = g++
CPPFLAGS = -L/usr/local/lib -Wl,-rpath -Wl,/usr/local/lib -lantlr3c -o
objects := $(grammar)Parser.o $(grammar)Lexer.o main.o
source := src/grmr/laban.g src/grmr/laban.h src/main/main.cpp src/visual/adot.ah src/graph/graph.h src/translate/translate.h src/translate/translate.cpp src/check/check.h
bin = ./bin/./laban
dot = dot -Tjpg 

.PHONY: clean

all:	bin/$(grammar) $(source)
	$(bin) tests/small
	$(dot) tests/small.dot -o tests/small.jpg
	$(bin) tests/large
	$(dot) tests/large.dot -o tests/large.jpg

./bin/$(grammar) $(source): 		
	cd src/grmr; make
	cd src/visual; make
	cd src/translate; make
	cd .objs; $(CPP) $(CPPFLAGS) $(grammar) $(objects); mv laban ../bin/

clean:	
	cd src/grmr; make clean
	cd src/visual; make clean
	cd src/translate; make clean
	rm -f tests/*.dag
	rm -f bin/laban
	rm -f tests/*.dot
	rm -f tests/*.jpg
